import java.util.LinkedList;
import java.util.ListIterator;

public class Iterators {
    public static void main(String[] args) {
        LinkedList<String> linkedList = new LinkedList<>();
        linkedList.add("hello");
        linkedList.add("world");
        linkedList.add("and");
        linkedList.add("f**k");
        linkedList.add("you");
        System.out.println(linkedList);
        //使用迭代器遍历链表，并试图通过查看其原码来进一步理解
        ListIterator<String> it = linkedList.listIterator();
        while (it.hasNext()){
            System.out.println(it.next());
        }
    }
}
